//
//  CYABTool.h
//  CreditAddressBook
//
//  Created by Lee on 15/5/18.
//  Copyright (c) 2015年 Lee. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CYHttpTool.h"
#import "CYDefaultRecordAO.h"
#import "CYPerson.h"
@class CYDefaultDataTypeModl;

@interface CYABTool : NSObject

/**
 *  匹配失信联系人
 *
 *  @param params  phones：电话号码组
 *  @param success
 *  @param failure
 */
+ (void)defaultRecordsWithParams:(NSDictionary *)params success:(void (^)(NSArray *cyPersons))success failure:(HttpRequestFailure)failure;

/**
 *  根据ID获取违约人详情
 *
 *  @param params  id：ID，page：页码
 *  @param success
 *  @param failure
 */
+ (void)defaultRecordsbyIdWithParams:(NSDictionary *)params success:(void (^)(NSArray *defrs))success failure:(HttpRequestFailure)failure;
/**
 *  根据ID查询
 *
 *  @param params
 *  @param success 返回CYDefaultDataTypeModl
 *  @param failure
 */
+ (AFHTTPRequestOperation *)defaultRecordTypeModelsbyIdWithParams:(NSDictionary *)params success:(void (^)(CYDefaultDataTypeModl *model))success failure:(HttpRequestFailure)failure;

/**
 *  疑似失信人
 *
 *  @param params
 *  @param success
 *  @param failure
 */
+ (AFHTTPRequestOperation *)ysDefaultPersonsWithParams:(NSDictionary *)params success:(void (^)(NSArray *defrs))success failure:(HttpRequestFailure)failure;

/**
 *  根据姓名匹配失信人
 *
 *  @param params
 *  @param success
 *  @param failure
 */
+ (void)defaultRecordsByNameWithParams:(NSDictionary *)params success:(void (^)(NSArray *defrs))success failure:(HttpRequestFailure)failure;

/**
 *  通讯录图片设置
 *
 *  @param params
 *  @param success
 *  @param failure
 */
+ (void)imageSelectPageWithKey:(NSString *)key page:(NSInteger)page flag:(NSInteger)flag success:(void (^)(NSArray *defrs))success failure:(HttpRequestFailure)failure;
+ (void)imageSelectPageWithParams:(NSDictionary *)par success:(void (^)(NSArray *defrs))success failure:(HttpRequestFailure)failure;

/**
 *  通话记录图片设置
 *
 *  @param params
 *  @param success
 *  @param failure
 */
+ (void)imageSelectOneWithParams:(NSDictionary *)params success:(void (^)(NSArray *defrs))success failure:(HttpRequestFailure)failure;

/**
 *  下载一张图片
 */
+ (void)downloadImageWithURL:(NSString *)url progress:(void (^)(NSInteger receivedSize, NSInteger expectedSize))progressBlock success:(void (^)(UIImage *image))success;
/**
 *  根据姓名或者性别或者地域进行疑似联系人筛选
 */
+ (void)getDefaultRecordsByCityAndSexWithParam:(NSDictionary *)param success:(void(^)(NSArray *defrs))success failure:(HttpRequestFailure1)failure;

/**
 *  存储一条数据
 *
 *  @param person
 */
+ (void)addCYPerson:(CYPerson *)person;

/**
 *  存储N条数据
 *
 *  @param persons
 */
+ (void)addCYPersons:(NSArray *)persons;

/**
 *  查找CYPerson
 *
 *  @param param
 *
 *  @return
 */
+ (NSArray *)personsWithParam:(NSDictionary *)param;

/**
 *  将RHPerson转为CYPerson
 *
 *  @param rhPerson
 *
 *  @return
 */
+ (CYPerson *)cyPersonFromRHPerson:(RHPerson *)rhPerson;

/**
 *  将RHPersons转为CYPersons
 *
 *  @param rhPersons
 *
 *  @return
 */
+ (NSArray *)cyPersonsFromRHPersons:(NSArray *)rhPersons;

/**
 *  格式化一个电话号码
 */
+ (NSString *)formatPhoneNumber:(NSString *)formatePhone;

/**
 *  格式化电话号码
 */
+ (NSArray *)formatPhoneNumbers:(NSArray *)phones;

//+ (void)saveMyDefaultRecords:(NSArray *)defrs;

/**
 *  获取RHAddressBook
 *
 *  @return 单例
 */
+ (RHAddressBook *)addressBook;

/**
 *  读取通讯录联系人
 *
 *  @return 
 */
+ (NSArray *)accessAllPeople;

/**
 *  重新读取通讯录联系人
 *
 *  @return
 */
+ (NSArray *)reloadAllPeople;

/**
 *  根据电话号码与名字查询RHPerson
 *
 *  @return
 */
+ (RHPerson *)rhPersonWithName:(NSString *)name phones:(NSArray *)phones;

/**
 *  积分商城任务获取积分，
 *  type:积分的类型.0-每日启动APP，1-打电话，2-换头像，3-分享，4-上传违约 5-铃声
 *
 *  @return
 */
+ (void)jfshopWithType:(NSString *)type success:(void (^)(NSString *message))success failure:(HttpRequestFailure)failure;
@end
